package a.a002;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test1 {
	public static void main(String[] args) throws Exception {
		
		String element = "@{name}";
		Pattern pattern1 = Pattern.compile("@\\{([\\s\\S]*?)\\}");
		Matcher matcher1 = pattern1.matcher(element);
		
		System.out.println("groupCount: " + matcher1.groupCount());
		
		if (matcher1.matches()) {
			System.out.println("==> 匹配成功");
			
			System.out.println(0 + "::\"" + matcher1.group(0) + "\"");
			System.out.println(1 + "::\"" + matcher1.group(1) + "\"");
//			System.out.println(2 + "::\"" + matcher1.group(2) + "\"");
//			System.out.println(3 + "::\"" + matcher1.group(3) + "\"");
//			System.out.println(4 + "::\"" + matcher1.group(4) + "\"");
//			System.out.println(5 + "::\"" + matcher1.group(5) + "\"");
//			System.out.println(6 + "::\"" + matcher1.group(6) + "\"");
//			System.out.println(7 + "::\"" + matcher1.group(7) + "\"");
//			System.out.println(8 + "::\"" + matcher1.group(8) + "\"");
			
		}else {
			System.out.println("==> 匹配失败");
		}
		
	}
}
